import Ember from 'ember';
import BaseBusiness from '../base-business';
import Pagination from '../pagination';

export default BaseBusiness.extend(Pagination,{
  pageyModelListName: "content",
  header_title: "站内消息",


  model() {
    console.log("model in message");
    return;
    //return this.doQuery();
    // return new Ember.RSVP.Promise(function (resolve, reject) {
    //   Ember.run.later(function(){
    //       resolve({});
    //   },100000);
    // });
  },
  doQuery:function(){
    var controller = this.get("controller");
    this.get("global_ajaxCall").set("action","messageTypeOne");
    var params = this.buildQueryParams();
    controller.infiniteQuery('message',params);
    // this.store.query("message",{filter:params.filter}).then(function (messageNews) {
    //   _self.getCurrentController().set("messageNews",messageNews);
    //   console.log("message1111",messageNews);
    // });
  },
  buildQueryParams:function(){
    var params = {};
    var curUser = this.get('global_curStatus').getUser();
    var filter = {toUser:{id:curUser.get("id")},type:1,type1:2};
    // var sort = {createTime:"desc"};
    // params.sort = sort;
    params.filter = filter;
    console.log("params filter",params);
    return params;
  },


  //设置controller信息，不再单独建立controller文件
  setupController:function(controller,model){
    this._super(controller,model);
    this.doQuery();
    console.log("controllermessage",controller);
  },

  actions:{
  
  }
});
